package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * PROJECT_NAME: sky-take-out
 * NAME: ShoppingCartMapper
 *
 * @AUTHOR: zhang
 * DATE: 2023/11/30
 * DESCRIPTION :
 */
@Mapper
public interface ShoppingCartMapper {
    /**
     * 根据dishId查询购物车
     * @param dishId
     * @return
     */
    ShoppingCart selectShoppingCartByDishId(@Param("dishId") Long dishId);

    /**
     * 根据setmealId查询购物车
     * @param setmealId
     * @return
     */
    ShoppingCart selectShoppingCartBySetmealId(@Param("setmealId") Long setmealId);

    /**
     * 更新数量
     * @param shoppingCart
     */
    void update(@Param("shoppingCart") ShoppingCart shoppingCart);

    /**
     * 新增购物车
     * @param newShoppingCart
     */
    void insertShoppingCart(@Param("newShoppingCart") ShoppingCart newShoppingCart);

    /**
     * 查询购物车信息
     * @param newShoppingCart
     * @return
     */
    List<ShoppingCart> selectShoppingCart(@Param("newShoppingCart") ShoppingCart newShoppingCart);

    /**
     * 删除菜品/套餐
     * @param cart
     */
    void delete(@Param("cart") ShoppingCart cart);
}
